package tech.aistar.corejava.day02;
@SuppressWarnings("all")
public class HomeWork {
    public static void main(String[] args) {
        /*Scanner sc=new Scanner(System.in);
        System.out.println("请输入半径:");
        double r = sc.nextDouble();
        double v = 4*Math.PI*Math.pow(r,3)/3;
        System.out.println("球的体积为:"+v);*/
        /**
         * @Description:    作用描述:三个字符或字符串从大到小排序
         * @Author:          lya
         * @CreateDate:     2019/7/16 19:52
         * @Version:        1.0
         */
        /*Scanner sc=new Scanner(System.in);
        System.out.println("请输入3个变量:");
        String arr[]=new String [3];
        for(int i=0;i<arr.length;i++){
            String var = sc.next();
            arr[i] = var;
        }
        System.out.print("排序前:");
        for(int i=0;i<arr.length;i++){
            System.out.print(arr[i]+" ");
        }
        System.out.println();
        Arrays.sort(arr);
        System.out.print("排序后:");
        for(int i=arr.length-1;i>=0;i--){
            System.out.print(arr[i]+" ");
        }*/
//第二题
        /*int a = 18;
        int b = 89;
        int c = 65;
        int arr[] = new  int [3];//定义数组
        arr[0] = a;
        arr[1] = b;
        arr[2] = c;
        Arrays.sort(arr);//排序
        for(int i=arr.length-1;i>=0;i--){
            System.out.println(arr[i]);
        }*/
//第三题
        /*int a = 18;
        int b = 89;
        int c = 65;
        int sum = a+b+c;
        System.out.println("sum = " + sum);
        int avg = sum/3;
        System.out.println("avg = " + avg);*/
//第四题
        /*int x = 856;
        int a = x/100%10;//取百分位
        int b = x/10%10;//取十分位
        int c = x%10;//取个位
        int sum = a + b + c;
        System.out.println("sum = " + sum);
        int mul = a * b * c;
        System.out.println("mul = " + mul);*/
//第五题
        /*int a = 5;
        int b = 6;
        //定义中间变量
        int temp;
        //交换数值
        temp = a;
        a = b;
        b = temp;
        System.out.println(a);
        System.out.println(b);*/
//第六题
        /*char var1 = 'A';
        char var2 = (char) (var1 + 32);
        System.out.println(var2);*/
//第七题
        int year = 2012;
        //定义月份
        int month = 2;
        //定义天数
        int maxDays = 0;

        switch (month) {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                maxDays = 31;
                break;
            case 2:
                maxDays = (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0) ? 29 : 28;
                break;
            default:
                maxDays = 30;
                break;
        }
        System.out.println(year + "年" + month + "月,最大天数是:" + maxDays);
    }
}
